/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.uoc.tdp.pac3.configuration;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Implementacio de IConfiguration que llegeix les propietats de un fitxer .properties.
 * @author gerard
 */
public class PropertiesConfiguration implements IConfiguration {
    
    private static PropertiesConfiguration instance = new PropertiesConfiguration();
    
    private Properties properties;

    private PropertiesConfiguration() {
        try {
            properties = new Properties();
            InputStream is = PropertiesConfiguration.class.getResourceAsStream("configuration.properties");
            properties.load(is);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
    public static PropertiesConfiguration getInstance(){
        return instance;
    }
    
    public String getProperty(String key){
        return properties.getProperty(key);
    }
    
}
